package com.itheima.HomeWork.homework01;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class Demo {
    public static void main(String[] args) throws IOException {
        Properties pro = new Properties();
//        extracted(pro);
        pro.load(new FileReader("iphone.properties"));
        Set<String> strings = pro.stringPropertyNames();
        for (String string : strings) {
            String property = pro.getProperty(string);
            System.out.println(string + ":" + property);

        }
        System.out.println(strings);
    }

    private static void extracted(Properties pro) throws IOException {
        pro.setProperty("brand", "Iphone11Pro Max");
        pro.setProperty("capacity", "256G");
        pro.setProperty("price", "10899");
        pro.store(new FileWriter("iphone.properties"), "iphone.properties");
    }
}
